class ArticlesController < ApplicationController
  layout 'articles'  
  
  before_filter :set_signed_user
  
  def index    
    #@options = {:controller_name => 'articles'}    
    # Should handle user is nil!
    @article_pages, @articles, @first_pager, @last_pager, @has_pre_pager, @has_next_pager = sql_paginator(:articles, :per_page => @this_blog.page_article_count, :order_by => 'published_at desc', :conditions => ["blog_id=?", @this_blog.id])
  end
  
  def show
    @article = Article.find(params[:id])
    @comments = @article.comments
    
    unless @signed_user.nil?
      @comment = Comment.new
    end
  end
  
  def tag
    @tag = Tag.find_by_name_or_display_name(params[:tagname],params[:tagname])
    if @tag.nil?
      @articles = []
    else
      @articles = @tag.articles
    end
  end
end
